package com.cardone.platform.authority.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import org.apache.commons.lang3.ArrayUtils;
import lombok.Getter;
import lombok.Setter;

import org.joda.time.DateTime;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.collections.MapUtils;
import com.google.common.collect.Maps;

import com.cardone.common.dto.PaginationDto;
import com.cardone.common.util.EntityUtils;
import com.cardone.context.Attributes;
import com.cardone.persistent.builder.ModelArgs;
import com.cardone.persistent.builder.Model;
import com.cardone.persistent.builder.ModelUtils;
import com.cardone.persistent.support.JdbcTemplateSupport;
import com.cardone.persistent.support.PaginationArgs;
import com.cardone.context.ContextHolder;
import com.cardone.context.DictionaryException;
import com.cardone.persistent.support.SimpleDao;
import com.cardone.persistent.support.SimpleJdbcDao;
import com.cardone.platform.authority.dto.PeVaRuTransactModeDto;

/**
 * 许可、验证规则与处理模式
 *
 * @author yaohaitao
 * 
 */
@Getter
@Setter
public class PeVaRuTransactModeJdbcDao extends SimpleJdbcDao<PeVaRuTransactModeDto> implements PeVaRuTransactModeDao {
	public PeVaRuTransactModeJdbcDao() {
		this.deleteByIds = SqlIds.deleteByIds.id();

		this.find = SqlIds.find.id();

		this.findByCode = SqlIds.findByCode.id();

		this.findById = SqlIds.findById.id();

		this.findByLikeCode = SqlIds.findByLikeCode.id();

		this.insertByCode = SqlIds.insertByCode.id();

		this.insertByNotExistsCode = SqlIds.insertByNotExistsCode.id();

		this.readByCode = SqlIds.readByCode.id();

		this.readByLikeCode = SqlIds.readByLikeCode.id();

		this.updateByCode = SqlIds.updateByCode.id();
	}

	@Override
	public boolean isBlankById(PeVaRuTransactModeDto dto) {
		return StringUtils.isBlank(dto.getId());
	}

	@Override
	public void setId(PeVaRuTransactModeDto dto) {
		dto.setId(UUID.randomUUID().toString());
	}
}